/*    */ package com.zimbra.qa.unittest;
/*    */ 
/*    */ import com.zimbra.client.ZMailbox;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import java.util.HashSet;
/*    */ import java.util.Set;
/*    */ import junit.framework.TestCase;
/*    */ import org.junit.Assert;
/*    */ import org.junit.Ignore;
/*    */ import org.junit.Test;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ @Ignore
/*    */ public class TestNoOp
/*    */   extends TestCase
/*    */ {
/*    */   private static final String USER_NAME = "user1";
/* 38 */   private static final String NAME_PREFIX = TestNoOp.class.getSimpleName();
/*    */   private static final int THREAD_COUNT = 5;
/*    */   private static final int LOOP_COUNT = 10;
/*    */   private static final int THREAD_TIMEOUT = 30000;
/*    */   
/*    */   public void setUp() throws Exception
/*    */   {
/* 45 */     cleanUp();
/*    */   }
/*    */   
/*    */   public void tearDown() throws Exception
/*    */   {
/* 50 */     cleanUp();
/*    */   }
/*    */   
/*    */   private void cleanUp() throws Exception {
/* 54 */     TestUtil.deleteTestData("user1", NAME_PREFIX);
/*    */   }
/*    */   
/*    */   @Test
/*    */   public void testNoOpMany() throws ServiceException {
/* 59 */     Set<Thread> threads = new HashSet();
/* 60 */     final Set<Exception> exceptions = new HashSet();
/* 61 */     for (int i = 0; i < 5; i++) {
/* 62 */       Thread t = new Thread()
/*    */       {
/*    */         public void run() {
/* 65 */           ZMailbox mbox = null;
/*    */           try {
/* 67 */             mbox = TestUtil.getZMailbox("user1");
/*    */           } catch (ServiceException e) {
/* 69 */             exceptions.add(e);
/* 70 */             return;
/*    */           }
/* 72 */           for (int j = 0; j < 10; j++) {
/*    */             try {
/* 74 */               mbox.noOp(1000L);
/*    */             } catch (ServiceException se) {
/* 76 */               exceptions.add(se);
/*    */             }
/*    */           }
/*    */         }
/* 80 */       };
/* 81 */       threads.add(t);
/*    */     }
/* 83 */     for (Thread t : threads) {
/* 84 */       t.start();
/*    */     }
/* 86 */     for (Thread t : threads)
/*    */     {
/*    */       try {
/* 89 */         t.join(30000L);
/*    */       }
/*    */       catch (InterruptedException e) {}
/* 92 */       Assert.assertFalse(t.isAlive());
/*    */     }
/* 94 */     if (!exceptions.isEmpty()) {
/* 95 */       for (Exception e : exceptions) {
/* 96 */         ZimbraLog.test.error("Exception during test", e);
/*    */       }
/* 98 */       Assert.fail(exceptions.size() + " exceptions during test");
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestNoOp.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */